//
//  CMessageSettingMgr.m
//  wanzhaoIM
//
//  Created by wanzhao on 15/8/12.
//  Copyright (c) 2015年 liuyuantao. All rights reserved.
//

#import "CMessageSettingMgr.h"
#import "FMDB.h"
#import "CFolderMgr.h"
#import "MicroDef.h"
//#import "CMessageSetting.h"


@implementation CMessageSettingMgr


//-(BOOL)insetMessageSettingWithSetting:(CMessageSetting *)setting
//{
//    if(setting == nil)
//    {
//        return NO;
//    }
//    
//    FMDatabaseQueue *queen = [FMDatabaseQueue  databaseQueueWithPath:[[CFolderMgr shareInstance] personalDatabasePathRecently]];
//    __block BOOL ret = NO;
//    [queen inDatabase:^(FMDatabase *db) {
//        
//        ret = [db executeUpdate:@"INSERT INTO MESSAESETTING (messageFromId, messageSettingType) VALUES (?, ?)",M_STOREVALUE(setting.messageFromId),setting.messageSettingType];
//    }];
//    return ret;
//}
//
////获取用户设置
//- (NSArray *)getMessageSetting
//{
//    NSString *sql = nil;
//    __block NSMutableArray *array = [NSMutableArray arrayWithCapacity:5];
//    sql = [NSString stringWithFormat:@"select * from MESSAESETTING" ];
//    FMDatabaseQueue *queen = [FMDatabaseQueue  databaseQueueWithPath:[[CFolderMgr shareInstance] personalDatabasePathRecently]];
//    [queen inDatabase:^(FMDatabase *db) {
//        FMResultSet *result = [db executeQuery:sql];
//        while ([result next]) {
//            CMessageSetting *setting = [[CMessageSetting alloc] init];
//            setting.messageFromId = [result stringForColumn:@"messageFromId"];
//            setting.messageSettingType = [result intForColumn:@"messageSettingType"];
//            [array addObject:setting];
//            setting = nil;
//        }
//    }];
//    return array;
//    
//}
//
//
//- (CMessageSetting *)getMessageSettingWithId:(NSString *)FromId
//{
//    __block CMessageSetting *setting = nil;
//    FMDatabaseQueue *queen = [FMDatabaseQueue  databaseQueueWithPath:[[CFolderMgr shareInstance] personalDatabasePathRecently]];
//    [queen inDatabase:^(FMDatabase *db) {
//        FMResultSet *result = [db executeQuery:@"select * from MESSAESETTING where messageFromId = ?",FromId];
//        while ([result next]) {
//           setting = [[CMessageSetting alloc] init];
//            setting.messageFromId = [result stringForColumn:@"messageFromId"];
//            setting.messageSettingType = [result intForColumn:@"messageSettingType"];
//        }
//    }];
//    return setting;
//
//}
//
//- (BOOL)updateMessageSetting:(CMessageSetting *)setting
//{
//    if(setting == nil)
//    {
//        return NO;
//    }
//    
//    FMDatabaseQueue *queen = [FMDatabaseQueue  databaseQueueWithPath:[[CFolderMgr shareInstance] personalDatabasePathRecently]];
//    __block BOOL ret = NO;
//    [queen inDatabase:^(FMDatabase *db) {
//        
//        ret = [db executeUpdate:@"UPDATE MESSAESETTING SET messageSettingType = ? where messageFromId = ?", setting.messageSettingType, M_STOREVALUE(setting.messageFromId)];
//    }];
//    return ret;
//    
//}
//
//- (BOOL)delMessageSetting
//{
//    FMDatabaseQueue *queen = [FMDatabaseQueue  databaseQueueWithPath:[[CFolderMgr shareInstance] personalDatabasePathRecently]];
//    __block BOOL ret = NO;
//    [queen inDatabase:^(FMDatabase *db) {
//        
//        ret = [db executeUpdate:@"delete from MESSAESETTING"];
//    }];
//    return ret;
//    
//}
//
//- (BOOL)delMessageSettingWithFromId:(NSString *)fromId
//{
//    FMDatabaseQueue *queen = [FMDatabaseQueue  databaseQueueWithPath:[[CFolderMgr shareInstance] personalDatabasePathRecently]];
//    __block BOOL ret = NO;
//    [queen inDatabase:^(FMDatabase *db) {
//        
//        ret = [db executeUpdate:@"delete from MESSAESETTING where messageFromId = ?",fromId];
//    }];
//    return ret;
//
//}

@end
